home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / laptop-mode-tools / modules / bluetooth < prev    next >
Encoding:
Text File  |  2012-05-20  |  1.3 KB  |  44 lines

  1. #! /bin/sh
  2. #
  3. # Laptop mode tools module: bluetooth
  4. #
  5.  
  6. if [ x$CONTROL_BLUETOOTH = x1 ] ; then
  7.     ENABLE_BLUETOOTH=$BATT_ENABLE_BLUETOOTH
  8.     if [ $ON_AC -eq 1 ] ; then
  9.         ENABLE_BLUETOOTH=$AC_ENABLE_BLUETOOTH
  10.     fi
  11.     if [ x$ENABLE_BLUETOOTH = x1 ] ; then
  12.         log "VERBOSE" "Enabling bluetooth."
  13.         modprobe -q hci_usb
  14.         for INTF in $BLUETOOTH_INTERFACES ; do
  15.             [ -d /sys/class/bluetooth/$INTF ] || continue
  16.             log "VERBOSE" "`hciconfig $INTF up 2>&1`"
  17.         done
  18.  
  19.         # For thinkpads, where the thinkpad_acpi driver is loaded,
  20.         # we can handle bluetooth easily
  21.         if [ -f /proc/acpi/ibm/bluetooth ]; then
  22.             log "VERBOSE" "Enabling ThinkPad Bluetooth device"
  23.             echo "enable" > /proc/acpi/ibm/bluetooth
  24.         fi
  25.     else
  26.         log "VERBOSE" "Disabling bluetooth."
  27.  
  28.         if [ -f /proc/acpi/ibm/bluetooth ]; then
  29.             log "VERBOSE" "Disabling ThinkPad Bluetooth device"
  30.             echo "disable" > /proc/acpi/ibm/bluetooth
  31.         fi
  32.         
  33.         for INTF in $BLUETOOTH_INTERFACES ; do
  34.             [ -d /sys/class/bluetooth/$INTF ] || continue
  35.             log "VERBOSE" "`hciconfig $INTF down 2>&1`" 
  36.         done
  37.         # This may take a while to work because the module may be
  38.         # temporarily in use; we try three times. We don't use rmmod
  39.         # --wait, because that might hang!
  40.         modprobe -rq hci_usb || (sleep 1 ; modprobe -rq hci_usb) || (sleep 1 ; modprobe -rq hci_usb)        
  41.     fi
  42. fi
  43.  
  44.